<script lang="ts" setup>
import { storeToRefs } from "pinia"
import { useSettingsStore } from "@/store/modules/settings"
// import logo from "@/assets/layouts/logo.png?url"
// import logoText1 from "@/assets/layouts/logo-text-1.png?url"
// import logoText2 from "@/assets/layouts/logo-text-2.png?url"
import LOGO from "@/assets/layouts/LOGO40px.svg"
import logoTxt from "@/assets/layouts/logoTxt.png"

interface Props {
  collapse?: boolean
}

const props = withDefaults(defineProps<Props>(), {
  collapse: true
})

const settingsStore = useSettingsStore()
const { layoutMode } = storeToRefs(settingsStore)
</script>

<template>
  <div class="layout-logo-container" :class="{ collapse: props.collapse, 'layout-mode-top': layoutMode === 'top' }">
    <transition name="layout-logo-fade">
      <router-link v-if="props.collapse" key="collapse" to="/">
        <img :src="LOGO" class="layout-logo" />
      </router-link>
      <router-link v-else key="expand" to="/">
        <img :src="logoTxt" class="layout-logo-text" />
      </router-link>
    </transition>
  </div>
</template>

<style lang="scss" scoped>
.layout-logo-container {
  position: relative;
  width: 100%;
  // height: var(--v3-header-height);
  line-height: var(--v3-header-height);
  background-color: transparent;
  overflow: hidden;

  padding-left: 10px;

  .layout-logo {
    display: none;
  }

  .layout-logo-text {
    height: 60%;
    vertical-align: middle;
    width: 60%;
  }
}

.layout-mode-top {
  height: var(--v3-navigationbar-height);
  // line-height: var(--v3-navigationbar-height);
  padding-left: 10px;
  text-align: left;
}

.collapse {
  text-align: center;
  padding-left: 0;

  .layout-logo {
    width: 32px;
    height: 32px;
    vertical-align: middle;
    display: inline-block;
  }

  .layout-logo-text {
    display: none;
  }
}
</style>
